package com.ziqikeji.socket.service;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * 服务端负责发送欢迎光临的线程类：
 * @author bcs
 */
public class GetOutputStream extends Thread{
    private Socket s;
    public GetOutputStream(Socket s) {
        this.s=s;
    }
    @Override
    public void run() {
        try {
            //获取输出流
            OutputStream ops= s.getOutputStream();
            String msg="欢迎光临！\n";
            //将msg写入流
            ops.write(msg.getBytes());
            //推送
            ops.flush();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
